home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / TEMP / GNU / flex / Endoffiler < prev    next >
Text File  |  1995-06-28  |  2KB  |  69 lines

  1. End-of-file rules
  2. Previous: <Multiple buffers=>Multiplebu> * Next: <Miscellaneous=>Miscellane> * Up: <Top=>!Root>
  3.  
  4. #Wrap on
  5. {fH3}End-of-file rules{f}
  6.  
  7. The special rule "<<EOF>>" indicates actions which are to
  8. be taken when an end-of-file is encountered and yywrap()
  9. returns non-zero (i.e., indicates no further files to
  10. process).  The action must finish by doing one of four
  11. things:
  12.  
  13. #Indent +4
  14.  
  15.  - assigning {fCode}yyin{f} to a new input file (in previous
  16. versions of flex, after doing the assignment you
  17. had to call the special action {fCode}YY\_NEW\_FILE{f}; this is
  18. no longer necessary);
  19.  
  20.  
  21.  - executing a {fCode}return{f} statement;
  22.  
  23.  
  24.  - executing the special {fEmphasis}yyterminate(){f} action;
  25.  
  26.  
  27.  - or, switching to a new buffer using
  28. {fEmphasis}yy\_switch\_to\_buffer(){f} as shown in the example
  29. above.
  30.  
  31. #Indent
  32.  
  33. <<EOF>> rules may not be used with other patterns; they
  34. may only be qualified with a list of start conditions.  If
  35. an unqualified <<EOF>> rule is given, it applies to {fEmphasis}all{f}
  36. start conditions which do not already have <<EOF>>
  37. actions.  To specify an <<EOF>> rule for only the initial
  38. start condition, use
  39.  
  40. #Wrap off
  41. #fCode
  42. <INITIAL><<EOF>>
  43. #f
  44. #Wrap on
  45.  
  46. These rules are useful for catching things like unclosed
  47. comments.  An example:
  48.  
  49. #Wrap off
  50. #fCode
  51. %x quote
  52. %%
  53.  
  54. …other rules for dealing with quotes…
  55.  
  56. <quote><<EOF>>   \{
  57.          error( "unterminated quote" );
  58.          yyterminate();
  59.          \}
  60. <<EOF>>  \{
  61.          if ( \*++filelist )
  62.              yyin = fopen( \*filelist, "r" );
  63.          else
  64.             yyterminate();
  65.          \}
  66. #f
  67. #Wrap on
  68.  
  69.